package cn.tedu.review;

import java.util.Arrays;

/**本类用于回顾String类*/
public class TestString {
    public static void main(String[] args) {
        char[] values = {'a','b','c'};
        String s1 = new String(values);
        String s2 = "abc";

        System.out.println(s1.equals(s2));//String类重写了equals(),比较的是串的具体内容
        System.out.println(s1.hashCode());
        System.out.println(s2.hashCode());
        System.out.println(s1);

        System.out.println(s1.length());
        System.out.println(s1.toUpperCase());
        System.out.println(s1.toLowerCase());
        System.out.println(s1.startsWith("c"));
        System.out.println(s1.endsWith("c"));
        System.out.println(s1.charAt(0));

        String s3 = "abcbdbeba";
        System.out.println(s3.indexOf("b"));
        System.out.println(s3.lastIndexOf("b"));

        System.out.println(s1.concat("cxy"));

        String s4 = "a b c d e";
        System.out.println(Arrays.toString(s4.split(" ")));

        String s5 = "   hhh  hh  ";
        System.out.println(s5.trim());


    }
}
